package businessLogic.transaction;

/**
 *
 * @author Alexander
 */
public class TransactionFactory {
    
    private final int JPA = 1;
    private final int JDBC = 2;
    private static  TransactionFactory instance;
    
    public Transaction getTransaction(int id){
        if (id == JPA){
            return new JPATransaction();
        } else if (id == JDBC){
            return new JDBCTransaction();
        } else {
            return null;
        }
    }
    
    public static synchronized TransactionFactory getInstance() {
        if (instance == null) {
            instance = new TransactionFactory();
        }
        return instance;
    }
    
}
